angular.module('YYOA', [ 'ngRoute', 'ngCookies' ]).run(
		function($cookies, $rootScope) {
			$rootScope.title = "YYOA";
			$rootScope.userName = setNull($cookies.loginName);
			$rootScope.password = setNull($cookies.loginPwd);
			$rootScope.role = setNull($cookies.role);
		}).config([ '$controllerProvider', function($controllerProvider) {
	$controllerProvider.allowGlobals();
} ]).config([ '$routeProvider', function($routeProvider) {
	$routeProvider.when('/home', {
		templateUrl : 'home.html',
		controller : 'HomeCtrl'
	}).when('/userInfo', {
		templateUrl : './user/userInfo.html',
		controller : 'UserInfoCtrl'
	}).when('/userList', {
		templateUrl : './user/userList.html',
		controller : 'UserListCtrl'
	}).when('/addCommodity', {
		templateUrl : './commodity/addCommodity.html',
		controller : 'AddCommodityCtrl'
	}).otherwise({
		redirectTo : '/home'
	});
} ]);

function setNull(element) {
	if (element == "\"\"") {
		element = null;
	}
	return element;
}